package greedy_algorithm

func CoinChangeGreedy(coins []int, amt int) int {
	i := len(coins) - 1
	count := 0
	for i >= 0 {
		current := coins[i]
		if current > amt {
			i--
			continue
		}
		amt -= current
		count++
	}
	if amt > 0 {
		return -1
	}
	return count
}
